public class AnimalRecognitionSystem {
    public static void main(String[] args) {
        AnimalRuleLibrary library = new AnimalRuleLibrary();

        // 添加规则到规则库
        library.addRule(new AnimalRule("HAS_MILK", "哺乳动物"));
        library.addRule(new AnimalRule("HAS_FEATHERS", "鸟"));
        library.addRule(new AnimalRule("CAN_FLY, CAN_LAY_EGGS", "鸟"));
        library.addRule(new AnimalRule("EATS_MEAT", "食肉动物"));
        library.addRule(new AnimalRule("HAS_SHARP_TEETH, HAS_CLAWS, EYES_FACE_FRONT", "食肉动物"));
        library.addRule(new AnimalRule("HAS_HOOVES", "有蹄类动物"));
        library.addRule(new AnimalRule("RUMINANT", "有蹄类动物"));
        library.addRule(new AnimalRule("HAS_TAN_COLOR, HAS_DARK_SPOTS", "豹"));
        library.addRule(new AnimalRule("HAS_TAN_COLOR, HAS_BLACK_STRIPES", "虎"));
        library.addRule(new AnimalRule("HAS_HOOVES, HAS_LONG_NECK, HAS_LONG_LEGS, HAS_DARK_SPOTS", "长颈鹿"));
        library.addRule(new AnimalRule("HAS_HOOVES, HAS_BLACK_STRIPES", "斑马"));
        library.addRule(new AnimalRule("HAS_LONG_NECK, HAS_LONG_LEGS, HAS_BLACK_AND_WHITE_COLORS, CANNOT_FLY", "鸵鸟"));
        library.addRule(new AnimalRule("CANNOT_FLY, CAN_SWIM, HAS_BLACK_AND_WHITE_COLORS", "企鹅"));
        library.addRule(new AnimalRule("IS_GOOD_AT_FLYING", "信天翁"));

        // 创建一个动物实例
        Animal giraffe = new Animal();
        giraffe.setFeature("HAS_MILK", true);
        giraffe.setFeature("HAS_HOOVES", true);
        giraffe.setFeature("HAS_DARK_SPOTS", true);
        giraffe.setFeature("HAS_LONG_NECK", true);
        giraffe.setFeature("HAS_LONG_LEGS", true);


        // 推理动物类型
        String animalType = library.deduceAnimalType(giraffe);
        System.out.println("推理出的动物类型是：" + animalType);
    }
}
